﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Back-end.Master" AutoEventWireup="true" CodeBehind="ThemNguoiDung.aspx.cs" Inherits="TracNghiemTinHocDaiCuong.ThemNguoiDung" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#txtNgaySinh").datepicker({
                changeMonth: true,
                changeYear: true,
                yearRange: '-100:+0'
            });
            $("#txtNgaySinh").datepicker("option", "dateFormat", "dd/mm/yy");
        }); 
    </script>
    <script type="text/javascript">
        function validateForm() {
            alert();
            var x = document.getElementById("txtEmail").value;
            var atpos = x.indexOf("@");
            var dotpos = x.lastIndexOf(".");
            if (atpos < 1 || dotpos < atpos + 2 || dotpos + 2 >= x.length) {
                alert("Not a valid e-mail address");
                return false;
            }
        }
    </script>
    <table border="0" cellspacing="2px" cellpadding="4px" width="80%" class="table">
    	<tr>
    		<td>Tên tài khoản</td>
            <td>
                <asp:TextBox ID="txtTenTaiKhoan" runat="Server" CssClass="txt"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>Mật khẩu</td>
            <td>
                <asp:TextBox ID="txtMatKhau" runat="Server" CssClass="txt" TextMode="Password"></asp:TextBox>
                <br />
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                ErrorMessage="Mật khẩu phải có ít nhất 6 kí tự" ForeColor="Red"
                ControlToValidate="txtMatKhau" ValidationExpression=".{6,}"></asp:RegularExpressionValidator>
            </td>
        </tr>
        <tr>
            <td>Nhắc lại mật khẩu</td>
            <td>
                <asp:TextBox ID="txtNhacLaiMatKhau" runat="Server" CssClass="txt" TextMode="Password"></asp:TextBox>
                <br />
                <asp:CompareValidator ID="cvMatKhau" runat="server" 
                ControlToValidate="txtNhacLaiMatKhau" ControlToCompare="txtMatKhau"
                ErrorMessage="Mật khẩu không khớp" ForeColor="Red"></asp:CompareValidator>
            </td>
        </tr>
        <tr>
            <td>Họ và tên</td>
            <td>
                <asp:TextBox ID="txtHoTen" runat="Server" CssClass="txt"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>Ngày sinh</td>
            <td>
                <asp:TextBox ID="txtNgaySinh" runat="Server" CssClass="txt" ClientIDMode="Static"></asp:TextBox>
            </td>
    	</tr>
        <tr>
            <td>Email</td>
            <td>
                <asp:TextBox ID="txtEmail" runat="Server" CssClass="txt"></asp:TextBox>
                <br />
                <asp:RegularExpressionValidator ID="revEmail" runat="server"
                ControlToValidate="txtEmail" ErrorMessage="Email không đúng"
                ForeColor="Red" 
                    ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
            </td>
    	</tr>
        <tr>
            <td>Giới tính</td>
            <td>
                <asp:RadioButtonList ID="rblGioiTinh" runat="Server" RepeatDirection="Horizontal">
                    <asp:ListItem Selected="True">Nam</asp:ListItem>
                    <asp:ListItem style="margin-left:100px">Nữ</asp:ListItem>
                </asp:RadioButtonList>
            </td>
    	</tr>
        <tr>
            <td>Điện thoại</td>
            <td>
                <asp:TextBox ID="txtDienThoai" runat="Server" CssClass="txt"></asp:TextBox>
                <br />
                <asp:RegularExpressionValidator ID="revDienThoai" runat="server"
                ControlToValidate="txtDienThoai" ForeColor="Red"
                ErrorMessage="Số điện thoại không đúng" ValidationExpression="\d{9,11}"></asp:RegularExpressionValidator>
            </td>
    	</tr>
        <tr>
            <td>Địa chỉ</td>
            <td>
                <asp:TextBox ID="txtDiaChi" runat="Server" CssClass="txt"></asp:TextBox>
            </td>
    	</tr>
        <tr>
            <td>Ngày đăng kí</td>
            <td>
                <asp:TextBox ID="txtNgayDangKi" runat="Server" CssClass="txt" 
                ReadOnly="true" BackColor="#E5E5E5"></asp:TextBox>
            </td>
    	</tr>
        <tr>
            <td>Là quản trị</td>
            <td>
                <asp:CheckBox ID="chkLaQuanTri" runat="server"/>
            </td>
    	</tr>
        <tr>
            <td>
                <asp:Label ID="lblThongBao" runat="server" CssClass="lblThongBao"></asp:Label>
            </td>
            <td>
                <asp:Button ID="btnXoaTuKhoa" runat="server" Text="Xóa từ khóa" OnClick="btnXoaTuKhoa_Click" CssClass="btn"/>
                <asp:Button ID="btnThemNguoiDung" runat="Server" Text="Thêm" OnClientClick="return validateForm();"
                OnClick="btnThemNguoiDung_Click" CssClass="btn"/>&nbsp&nbsp
                <asp:Button ID="btnBack" runat="Server" Text="Quay lại"
                OnClick="btnBack_Click" CssClass="btn"/>
            </td>
        </tr>
    </table>
</asp:Content>

